﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Net.Mail;

public partial class Contact : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        try
        {
            MailMessage msg = new MailMessage();
            msg.From = new MailAddress(YourEmail.Text);
            msg.To.Add("info_gile@yahoo.com");
            msg.Subject = YourSubject.Text;
            msg.Body = "Име: " + YourName.Text + "<br/> Е-маил: " + YourEmail.Text + "<br/>Наслов: " + YourSubject.Text + "<br/>Содржина: " + Comments.Text;
            msg.IsBodyHtml = true;
            SmtpClient smt = new SmtpClient("smtp.gmail.com", 587);
            smt.EnableSsl = true;
            smt.Credentials = new System.Net.NetworkCredential("info_gile@yahoo.com", "lozinka");
            smt.Send(msg);
            DisplayMessage.Text = "Вашата порака е успешно испратена!";
            DisplayMessage.Visible = true;
        }
        catch (Exception)
        {
            DisplayMessage.Text = "Вашата порака не се испрати!";
            DisplayMessage.Visible = true;
        }
    }
    protected void btnReset_Click(object sender, EventArgs e)
    {
        YourName.Text = "";
        YourEmail.Text = "";
        YourSubject.Text = "";
        Comments.Text = "";
    }
}